Destroys the object.

<div class="definition">
    destroy()
</div>
Returns <i>undefined</i>.

<h4>Description</h4>

The <span class="argument">destroy()</span> method will remove the object from the screen (if it is rendered), remove it
from <span class="argument">w2ui</span> object array and destroy all related objects. For example, if it is a grid, it will destroy
grid's toolbar. This method emits <a class="method" href="w2grid.onDestroy">.onDestroy</a> event.
<div style="height: 10px"></div>

<textarea class="javascript">
let layout = new w2layout({
    name    : 'layout',
    panels  : [
        { type: 'top', size: 40 },
        { type: 'main', content: 'This is main panel' },
        { type: 'preview', size: 200, hidden: true }
    ]
});

// ...
// some code
// ...

w2ui.layout.destroy();
</textarea>

You can also use <span class="argument">w2destroy()</span> method defined in <a href="utils">utilities</a>.

<textarea class="javascript">
$().w2destroy('layout');
</textarea>